﻿<Window x:Class="ChatDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Chat Demo" Height="350" Width="525"        >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <ListBox Margin="0,0,0,3" BorderThickness="0"
            ItemsSource="{Binding Conversation}">
            <ListBox.ItemTemplate>
                <DataTemplate >
                    <TextBlock TextWrapping="Wrap">
                        <Run Text="{Binding WhenUTC, Mode=OneTime}" Foreground="{Binding TextBrush}"/>
                        <Run Text="{Binding User, Mode=OneTime}" Foreground="{Binding TextBrush}"/>
                        <Run Text="{Binding Message, Mode=OneTime}" Foreground="{Binding TextBrush}"/>
                    </TextBlock>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <GridSplitter VerticalAlignment="Bottom" HorizontalAlignment="Stretch" Height="3" />
        <Grid Grid.Row="1" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Now, FallbackValue='00:00'}" />
            <TextBox Grid.Column="1" Text="{Binding User, FallbackValue=User1}" BorderThickness="0"/>
            <TextBox Grid.Column="2" Text="{Binding Typing, Mode=TwoWay}" BorderThickness="0" KeyDown="TextBox_KeyDown"/>
            <Button x:Name="SendButton" VerticalContentAlignment="Center" Grid.Column="3" Padding="6,3" Command="{Binding SendCommand}">Send</Button>
        </Grid>
    </Grid>
</Window>
